package lib.config
{
	import lib.view.DefaultModuleMediator;
		
	public class ModuleConfig
	{
		public static const DEFAULT_MODULE:String = "Default";
		public static const DEFAULT_ROUTE:String = "";
		
		public static var enabledModules:Array = [
			"Default"
		];
		
		protected static var moduleMediators:Object = {
			"Default": DefaultModuleMediator
		};
		
		public static function getModuleMediator(module:String):Object
		{
			return ModuleConfig.moduleMediators[ModuleConfig.cleanModuleName(module)];	
		}
		
		public static function isModuleEnabled(module:String):Boolean
		{
			module = ModuleConfig.cleanModuleName(module);
			for(var i:Number = 0; i < ModuleConfig.enabledModules.length; i++)
			{
				if (ModuleConfig.enabledModules[i] == module)
				{
					return true;
				}
			}
			return false;
		}
		
		private static function cleanModuleName(moduleName:String):String
		{
			if (moduleName.indexOf("Module") > -1)
			{
				return moduleName.substr(0, moduleName.indexOf("Module"));
			}
			else
			{
				return moduleName;
			}
		}
	}
}